From f937049ea82ac74635861b3a780d1372f681cc6b Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Sun, 16 Apr 2017 08:18:10 +0300
Subject: [PATCH] pcap_io.h: fix if_arp.h musl libc/kernel headers conflict

Use libc provided arp definitions to avoid build failure with musl libc:

In file included from pcap_io.h:19:0,
                 from trafgen.c:59:
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/linux/if_arp.h:113:8: error: redefinition of ‘struct arpreq’
 struct arpreq {
        ^
In file included from .../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netinet/if_ether.h:111:0,
                 from .../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/net/ethernet.h:10,
                 from trafgen.c:23:
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/net/if_arp.h:99:8: note: originally defined here
 struct arpreq {
        ^

Add a local definition of the ARPHRD_CAN macro that glibc does not provide.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---

Patch status: sent upstream
http://www.mail-archive.com/netsniff-ng%40googlegroups.com/msg01974.html

 built_in.h | 4 ++++
 pcap_io.h  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/built_in.h b/built_in.h
index d10579abd689..fa8af60d6029 100644
--- a/built_in.h
+++ b/built_in.h
@@ -382,6 +382,10 @@ static inline u64 cpu_to_le64(u64 val)
 # define PACKET_QDISC_BYPASS 20
 #endif
 
+#ifndef ARPHRD_CAN
+# define ARPHRD_CAN			280
+#endif
+
 #ifndef ARPHRD_IEEE802154_MONITOR
 # define ARPHRD_IEEE802154_MONITOR	805
 #endif
diff --git a/pcap_io.h b/pcap_io.h
index 3d70b217ada6..088858e89ccd 100644
--- a/pcap_io.h
+++ b/pcap_io.h
@@ -16,7 +16,7 @@
 #include <sys/socket.h>
 #include <linux/if.h>
 #include <linux/if_packet.h>
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
 
 #include "built_in.h"
 #include "die.h"
-- 
2.11.0

